<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //1、数组的展开
        var array1=[1,2,3];
        var array2=[...array1,4,5,6];  //将array1展开
        console.log(array2);

        //2、对象的展开
        var car={"name":"汽车","color":"白色"};
        var bus={speed:50,name:"公交车",...car};  //展开car，覆盖已的属性
        console.log(bus);
        var suv={speed:130,...car,name:"SUV"};  //展开car，name属性被后定义的name覆盖
        console.log(suv);

        //3、展开数组作为函数的参数
        function add(m,n,k){
            console.log(m,n,k);
        }
        add(...[100,200,300]);
    </script>
</body>
</html>